package com.daidai.service.impl;

import com.daidai.dao.BookDao;
import com.daidai.domain.Book;
import com.daidai.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {

    @Autowired
    private BookDao bookDao;

    @Override
    public List<Book> getAllBooks() {
        List<Book> books = bookDao.getAllBooks();
        return books;
    }

    @Override
    public Book getBookById(Integer id) {
        Book book = bookDao.getBookById(id);
        return book;
    }

    @Override
    public int saveBook(Book book) {
        return bookDao.saveBook(book);
    }

    @Override
    public int deleteBook(Integer id) {
        return bookDao.deleteBook(id);
    }

    @Override
    public int updateBook(Book book) {
        return bookDao.updateBook(book);
    }
}
